<?php
/**
 * 活动模型
 * @author cjli
 *
 */
class ActivityModel extends Model
{
	/**
	 * 查询是否符合时间条件，当前时间有没有秒杀活动
	 * @param int $start_time 开始时间
	 * @param int $end_time 结束时间
	 * @param int $fid 产品ID号
	 * @return (boolean)$result;
	 */
	public static function timeVerify($start_time, $end_time, $fid = 0)
	{
        $where['_string']  = ' ((start_time <= '.$start_time.' and end_time >= '.$start_time.')';
        $where['_string'] .= ' or (start_time <= '.$end_time.' and end_time >= '.$end_time.'))';
        if(intval($fid) > 0) $where['_string'] .= ' and id != '.$fid;

        $seckill_db = D('seckill');
        $result = $seckill_db->where($where)->count();
        return (boolean)$result;
	}
}
